package com.ytd.smartcanteen.weighting.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.ytd.smartcanteen.weighting.bean.MealCategoryInfo;

import java.util.List;

/**
 * 餐品表
 *
 * @author gaoguanchao
 * @since 2023/3/24
 */
@Dao
public interface MealCategoryInfoDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(MealCategoryInfo mealInfo);

    @Update
    void update(MealCategoryInfo mealInfo);

    @Delete
    void delete(MealCategoryInfo mealInfo);

    @Query("DELETE FROM mealcategoryinfo")
    void deleteAll();

    @Query("SELECT * FROM mealcategoryinfo")
    List<MealCategoryInfo> getAll();

    @Query("SELECT * FROM mealcategoryinfo where id = :categoryId")
    MealCategoryInfo getCategoryForId(String categoryId);

}
